<table class="table">
  <thead>
    <tr>
      <% if @product.has_variants? %>
        <th scope="col"><%= Spree.t(:variant) %></th>
      <% end %>
      <th scope="col"><%= sort_link @search, :name, Spree.t(:name) %></th>
      <th scope="col"><%= Spree.t(:size) %></th>
      <th scope="col"></th>
    </tr>
  </thead>
  <tbody>
    <%= render partial: "spree/admin/digital_assets/digital_asset",
    collection: @product.digitals.includes(:variant, attachment_attachment: [:blob]), cached: spree_base_cache_scope %>
    <% if @product.digitals.empty? %>
      <tr>
        <td colspan="4">
          <div
            class="
              text-muted p-5 d-flex align-items-center w-100 justify-content-center
            "
          >
            <%= Spree.t(:no_resource_found, resource: Spree.t(:digital_assets)) %>
            <% if can?(:create, Spree::Digital.new(variant: @product.default_variant)) %>
              <%= link_to_with_icon "plus",
              Spree.t(:add_one),
              spree.new_admin_product_digital_asset_path(@product),
              class: "btn btn-light ml-3",
              data: {
                turbo_frame: "dialog",
                action: 'dialog#open',
              } %>
            <% end %>
          </div>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
